#ifndef __TIMER_MANAGER_HH__
#define __TIMER_MANAGER_HH__

#include <functional>
#include <memory>

using std::function;
using std::unique_ptr;
class TimerManager
{

public:
    static TimerManager* createTimer(int initSec, int peridocSec);
    static void destoryTimer();


    void start();
    void stop();

    int createTimerFd(); // 创建定时器文件描述符

    void setTimerFd(int initSec, int periodSec);   // 设置定时器

    int getTimerFd();
    static void beginTimerTask();

private:
    TimerManager(int initSec, int peridocSec);
    ~TimerManager();


    
private:
    int _timerfd;
    int _initSec;   // 起始时间
    int _periodSec; // 循环时间
    
    static TimerManager* _instance;
};

#endif